# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=weeman
pkgver=91.53c2efa
pkgrel=3
groups=('blackarch' 'blackarch-social')
pkgdesc='HTTP Server for phishing in python.'
arch=('any')
url='https://github.com/Hypsurus/weeman'
license=('GPL3')
depends=('python2' 'python2-beautifulsoup4' 'python2-html5lib' 'python2-lxml'
         'python2-pdb')
makedepends=('git')
source=("git+https://github.com/Hypsurus/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  find . -type f -name '*.py' -exec \
    sed -i 's|history.log|/tmp/history.log|' {} \;
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md ChangeLog

  rm README.md ChangeLog

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

